// {
//     "uid": 20,
//     "name": "xxx",
//     "ident": "xxx",
//     "gender": 1,
//     "relation": 3,
//     "province": "上海",
//     "city": "闵行",
//     "platforms": [
//         "Java EE",
//         "PHP",
//         ".NET/C#",
//         "JavaScript",
//         "Delphi/Pascal"
//     ],
//     "expertise": [
//         "WEB开发",
//         "服务器端开发",
//         "DBA/数据库"
//     ],
//     "joinTime": "2008-09-18 09:17:15.0",
//     "lastLoginTime": "2012-03-13 15:22:58.0",
//     "portrait": "http://www.oschina.net/uploads/user/0/20_50.jpg",
//     "notice": {
//         "replyCount": 0,
//         "msgCount": 0,
//         "fansCount": 0,
//         "referCount": 0
//     }
// }

class UserDetail {
  int uid;
  String name;
  String ident;
  int gender;
  int relation;
  String province;
  String city;
  List platforms;
  List expertise;
  String joinTime;
  String lastLoginTime;
  String portrait;
  Notice notice;
  UserDetail.fromJson(Map<String, dynamic> map)
      : uid = map["uid"],
        name = map["name"],
        ident = map["ideng"],
        gender = map["gender"],
        relation = map["relation"],
        province = map["province"],
        city = map["city"],
        platforms = map["platforms"],
        expertise = map["expertise"],
        joinTime = map["joinTime"],
        lastLoginTime = map["lastLoginTime"],
        portrait = map["portrait"],
        notice = Notice.fromJson(map["notice"]);

  String get location {
    return "$province,$city";
  }

  String get sex => gender == 1 ? "男" : "女";
  String get expertiseJoin => expertise == null ? "" : expertise.join(",");
  String get platformsJoin => platforms == null ? "" : platforms.join(",");

  @override
  String toString() {
    return "UserDetail: {name: $name}, city: $city, gender: $gender, relation: $relation, expertise: $expertise, notice: $notice";
  }
}

class Notice {
  int replyCount;
  int msgCount;
  int fansCount;
  int referCount;
  Notice.fromJson(Map<String, dynamic> map) {
    replyCount = map["replyCount"];
    msgCount = map["msgCount"];
    fansCount = map["fansCount"];
    referCount = map["referCount"];
  }

  @override
  String toString() {
    // TODO: implement toString
    return "Notice {replyCount: $replyCount, msgCount: $msgCount,fansCount: $fansCount, referCount: $referCount }";
  }
}
